/*
 * infothread.h
 *
 *  Created on: Apr 25, 2011
 *      Author: xrose
 */

#ifndef INFOTHREAD_H_
#define INFOTHREAD_H_
#include "incdefault.h"
#include <string>

using namespace std;
class thrdStruct{
private:
	uint _id;		//thread ID
	ulong _stByte;	//position that thread ID start downloading
	ulong _endByte;	//position that thread ID end downloading
	ulong _dledByte;	//Amount of downloaded in Bytes
	ulong _filePos;	//postion to start writing
	uint _dlStatus;	//0 when thread completed
public:
	/**
	 * Constructor
	 */
	thrdStruct():_id(0), _stByte(0), _endByte(0), _dledByte(0), _filePos(0), _dlStatus(0){};
	thrdStruct(int id, ulong stByte, ulong endByte){
		cout<<"DEBUG: ...thrdStruct::thrdStruct(int, ulong, ulong): id = "<<id<<endl;
		cout<<"DEBUG: ...thrdStruct::thrdStruct(int, ulong, ulong): startByte = "<<stByte<<endl;
		cout<<"DEBUG: ...thrdStruct::thrdStruct(int, ulong, ulong): endByte = "<<endByte<<endl;
		_id = id;
		_stByte = stByte;
		_endByte = endByte;
		_dledByte = 0;
		_filePos = stByte;
		_dlStatus = 0;
	}
	thrdStruct(const thrdStruct &infThread){
		_id = infThread._id;
		_stByte = infThread._stByte;
		_endByte = infThread._endByte;
		_dledByte = infThread._dledByte;
		_dlStatus = infThread._dlStatus;
		_filePos = infThread._filePos;
	}
	char buffer[BUFFER_SIZE];		//temporary before write to file
	int getID(){return _id;}
	void setID(int id){_id = id;}
	ulong getStByte(){
		cout<<"DEBUG:...thrdStruct::getStByte(): _stByte = "<<_stByte<<endl;
		return _stByte;
	}
	void setStByte(ulong stByte){
		cout<<"DEBUG:thrdStruct::setStByte(): stByte = "<<stByte<<endl;
		_stByte = stByte;
	}
	ulong getEndByte(){
		cout<<"DEBUG:...thrdStruct::getEndByte(): _endByte = "<<_endByte<<endl;
		return _endByte;}
	void setEndByte(ulong endByte){_endByte = endByte;}
	ulong getDledByte(){return _dledByte;}
	void setDledByte(ulong dledByte){_dledByte = dledByte;}
	int getDlStatus(){return _dlStatus;}
	void setDlStatus(int dlStatus){_dlStatus = dlStatus;}
	ulong getFilePos(){return _filePos;}
	void setFilePos(ulong filePos){_filePos = filePos;}
	/**
	 * Destructor
	 */
	~thrdStruct(){}
};

#endif /* INFOTHREAD_H_ */
